/* 
 * File:   OutputFile.cpp
 * Author: gian
 * 
 * Created on March 9, 2013, 3:42 PM
 */

#include <stdexcept>
#include "OutputFile.hpp"

OutputFile::OutputFile(char *filename) {
    stream = fopen(filename,"wb");
    if(stream==NULL) {
        throw std::runtime_error("Can't open output file");
    }
}


OutputFile::~OutputFile() {
    if(stream!=NULL) {
        fclose(stream);
    }
}

FILE *OutputFile::file()
{
    return stream;
}


InputFile::InputFile(char *filename) {
    stream = fopen(filename,"rb");
    if(stream==NULL) {
        throw std::runtime_error("Can't open output file");
    }
}


InputFile::~InputFile() {
    if(stream!=NULL) {
        fclose(stream);
    }
}

FILE *InputFile::file()
{
    return stream;
}
